package com.example.alldemo.bean;

import com.example.alldemo.Filter.GalbaleFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
public class FilterBean {

    @Autowired
    public GalbaleFilter galbaleFilter;

    @Bean
    public FilterRegistrationBean setFilter(){

        FilterRegistrationBean filterBean = new FilterRegistrationBean();
        filterBean.setFilter(galbaleFilter);
        filterBean.setName("FilterController");
        filterBean.addUrlPatterns("/*");
        return filterBean;
    }
}
